<%@ page language="java" import="java.util.*, com.zjut.zs.util.tools.*,
com.zjut.an.admin.manager.*, com.zjut.an.admin.dao.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>个人信息</title>
	<meta name="renderer" content="webkit">	
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">	
	<meta name="apple-mobile-web-app-status-bar-style" content="black">	
	<meta name="apple-mobile-web-app-capable" content="yes">	
	<meta name="format-detection" content="telephone=no">	
	<link rel="stylesheet" type="text/css" href="../plugins/layuiadmin/layui/css/layui.css" media="all">
	<link rel="stylesheet" type="text/css" href="common/bootstrap/css/bootstrap.css" media="all">
	<link rel="stylesheet" type="text/css" href="common/global.css" media="all">
	<link rel="stylesheet" type="text/css" href="css/personal.css" media="all">
</head>
<body>
<%
	if (session.getAttribute("admin") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='AdminLogin.html';</script>");
	out.close();
	return;
} 
ZsHTMLCreat html = (ZsHTMLCreat) SpringContextUtil.getBean("ZsHTMLCreat");
AnAdminManager amanager = (AnAdminManager) SpringContextUtil.getBean("AnAdminManager");
AnAdmin admin = (AnAdmin)session.getAttribute("admin");
%>
<section class="layui-larry-box">
	<div class="larry-personal">
		<header class="larry-personal-tit">
			<span>个人信息</span>
		</header><!-- /header -->
		<div class="larry-personal-body clearfix">
			<form class="layui-form col-lg-5" action="" method="post">
				<div class="layui-form-item">
					<label class="layui-form-label">用户名</label>
					<div class="layui-input-block">  
						<input type="text" name="account"  autocomplete="off"  class="layui-input layui-disabled" value="<%=admin.getAccount() %>" disabled="disabled" >
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">密码</label>
					<div class="layui-input-block">  
					  	<input type="password" name="psw" lay-verify="required|password" autocomplete="off"  class="layui-input" value="<%=admin.getPassword()%>" placeholder="请输入密码">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">确认密码</label>
					<div class="layui-input-block">  
					  	<input type="password" lay-verify="required|repass" autocomplete="off"  class="layui-input" value="<%=admin.getPassword()%>" placeholder="请输入确认密码">
					</div>
				</div>
				
				<div class="layui-form-item">
					<div class="layui-input-block">
						<input type="text" name="lastlogin" value="<%=admin.getLastlogin()%>" style="display:none;">
						<input type="text" name="adId" value="<%=admin.getAdId() %>" style="display:none;">
						<input type="text" name="roId" value="<%=admin.getRoId() %>" style="display:none;">
						<input type="text" name="phone" value="<%=admin.getPhone() %>" style="display:none;">
						<input type="text" name="email" value="<%=admin.getEmail() %>" style="display:none;">
						<input type="text" name="active" value="<%=admin.getActive() %>" style="display:none;">
						<button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</section>
<script src="../plugins/layuiadmin/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript">
	var $;
	layui.use(['jquery'], function(){ 
	   $ = layui.$;
	});
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
  
  //自定义验证规则
	form.verify({
	    password:function(value){
	    	if(value.length < 8){
	    		return '密码长度至少8位';
	    	}
	    	var lvl = 0;
		    if (/[0-9]/.test(value)) {
		          lvl++;
		    }
		    if (/[a-zA-Z]/.test(value)) {
		          lvl++;
		    }
		    if (/[^0-9a-zA-Z_]/.test(value)) {
		          lvl++;
		    }
		   	if(lvl < 2){
		   		return '密码强度太弱，至少包含数字，字母，特殊符号中的两种';
		   	}
	    },
	    repass:function(value){
	    	if($("input[name='psw']").val()!=value){
	    		return '两次输入的密码不一致';
	    	}
	    }
	});
  
  
  //监听提交
  form.on('submit(demo1)', function(data){
    var rowStr = data.field;
    delete rowStr.deId;
    $.ajax({
      	type:"post",
      	url:"../adminUpdate.action",
      	data:{
      		rowstr:JSON.stringify(rowStr)
      	},
      	async:true,
      	cache:false,
      	success:function(res){
      		layer.msg('提交成功');
      	}
      });
    return false;
  });
  
});
</script>
</body>
</html>